home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 06 - 1990 / 06.06 Jun 90 / XCMD Source / WindowUtils.h < prev   
Encoding:
C/C++ Source or Header  |  1990-04-05  |  3.1 KB  |  123 lines  |  [TEXT/KAHL]

  1. /********************************/
  2. /* File: DrawCommands.h            */
  3. /*                                 */
  4. /* ----------------------------    */
  5. /* © 1989 Donald Koscheka        */
  6. /* All Rights Reserved            */
  7. /********************************/
  8.  
  9. #include    <MacTypes.h>
  10. #include    <OSUtil.h>
  11. #include    <MemoryMgr.h>
  12. #include    <FileMgr.h>
  13. #include    <ResourceMgr.h>
  14. #include    <pascal.h>
  15. #include    <string.h>
  16. #include    <stdio.h>
  17. #include    <hfs.h>
  18. #include    <sane.h>
  19. #include    <SANEUtils.h>
  20.  
  21. #define        WINDOW_HDR        10
  22.  
  23. /***** TOKEN RESOURCE IDS    *****/
  24. #define        DRAW_COMMANDS        12561
  25. #define        WINDOW_TYPES        8499        /* id of the window type resource    */
  26.  
  27. #define        STRING_TYPE            'STR#'
  28. #define        FALSE                0
  29. #define        TRUE                1
  30.  
  31.  
  32. #define        CR                    0x0D
  33. #define        NEWLINE                0x0D
  34. #define        LF                    0x0A
  35. #define        TAB                    0x09
  36.  
  37. #define        TEXT_SIZE            9            /* size of default fonts            */
  38.  
  39.  
  40. /* List of drawing commands    */
  41.  
  42. #define DATA_SET_HEADER    \
  43.     Handle    next;        \
  44.     Handle    last;        \
  45.     short    token;    
  46.  
  47.     
  48. /*** these are the data declarations for the     ***/
  49. /*** type of data that we plot.                 ***/
  50.  
  51. /*** !!! IN THE FUTURE, USE EXTENDED TO AVOID    ***/
  52. /*** UNNECESARY CONVERSIONS                     ***/
  53. typedef        extended    plot_data;
  54. typedef        plot_data    *plot_ptr;
  55. typedef        plot_ptr    *plot_hand;
  56.  
  57.     
  58.     
  59. typedef    struct dataSet{
  60.     DATA_SET_HEADER
  61. }dataSet, *dataPtr, **dataHand;
  62.  
  63.     
  64. typedef struct titleObj{
  65.     DATA_SET_HEADER
  66.     Rect        theRect;
  67.     short        font;
  68.     short        size;
  69.     short        style;
  70.     short        just;
  71.     short        color;
  72.     Handle        text;            /* Handle to the text itself    */
  73. }titleObj, *titlPtr, **titlHand;
  74.  
  75.  
  76.  
  77. /********************************/
  78. /* We maintain a private window    */
  79. /* list in the system heap in     */
  80. /* the following structure.        */
  81. /*                                */
  82. /* I call these window things    */
  83. /* "posts" in honor of the         */
  84. /* post-it note which is an        */
  85. /* interesting communications    */
  86. /* medium in its own right        */
  87. /********************************/
  88.  
  89. typedef struct post{
  90.     struct    post    **next;            /*** handle to next window        ***/
  91.     struct    post    **last;            /*** handle to previous window    ***/
  92.     WindowPtr        wind;            /*** pointer to our window        ***/
  93.     WindowRecord    wStore;            /*** toolbox window record        ***/
  94.     ListHandle        list;            /*** window's drawing objects    ***/
  95.     char            name[32];        /*** the name of this window    ***/
  96.     short            is_color;        /*** True if color window        ***/
  97.     short            id;                /*** id of  window (reserved)    ***/
  98. }post, *postPtr, **postHand;
  99.  
  100.  
  101.  
  102. /********************************/
  103. /* Internal globals are         */
  104. /* stored in the system heap     */
  105. /* in the following structure    */
  106. /*                                */
  107. /********************************/
  108.  
  109. typedef struct{
  110.     postHand    list;                /*** list of post-it notes             ***/
  111.     Handle        evtProc;            /*** Points to our event handler    ***/
  112.     ProcPtr        oldTrap;            /*** previous address of event trap    ***/
  113.     Handle        userData;            /*** for use by the application        ***/
  114. } wdGlobals, *wdGlobalsPtr, **wdGlobalsHand;
  115.  
  116.  
  117. void        *GetWindowHeader( short    theTrap );
  118. void        SetWindowHeader(  short    theTrap,  void *theHeader );
  119. postHand    find_post( wdGlobalsPtr    windP, WindowPtr which );
  120. void        remove_post( wdGlobalsPtr wdPtr, postHand postIt );
  121. void        add_post( wdGlobalsPtr    wdPtr, postHand postIt );
  122. postHand    Find_Window_By_Name( postHand    postList,  char    *name );
  123.